<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    用户名: <input class="zh" type="text">
    密码: <input class="mm" type="password">
    <button>登录</button>
</body>
</html>
<script>
    var zh=document.querySelector(".zh");
    var mm=document.querySelector(".mm");
    var but=document.querySelector("button");
    but.onclick=function(){
        if(zh.value=="11"&&mm.value=='11'){
            alert('登录成功')
        }else{
            alert("失败");
        }
    }
</script>